package com.black.quick.service;

import com.black.quick.dao.OrderDao;
import com.black.quick.domain.OrderInfo;
import com.black.quick.domain.QuickUser;
import com.black.quick.vo.GoodsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author shy_black
 * @date 2019/7/27 13:22
 * @Description:
 */
@Service
public class QuickService {

    @Autowired
    OrderService orderService;

    @Autowired
    GoodsService goodsService;

    @Transactional
public OrderInfo quick(QuickUser user, GoodsVo goods) {
        //减库存，下订单，写入秒杀订单
        goodsService.reduceStock(goods);
        //
        return orderService.createOrder(user,goods);
    }
}
